<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>registration</title>
        <style>@import url(resources/css/index_theme.css)</style>

    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit styleClass="topLayout" position="north" size="250" resizable="true">
                <div align="center">
                    <img height="230px" src="resources/images/titolo90.png" alt="" align="center"/>
                </div>
            </p:layoutUnit>

            <p:layoutUnit styleClass="centralBlock" position="center">
                <table align="center" width="90%">
                    <tr>
                        <td colspan="3">
                            <div id="descriptionDiv" align="center">
                                Registering to MeteoCAL is simple and free.<br/>
                                Fill the form and access to all the application functionalities immediatly!
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td width="25%">&nbsp;</td>
                        <td width="50%" align="center">
                            <br/>
                            <f:view>
                                <h:form>
                                    <p:growl id="growl" autoUpdate="true" showDetail="false"/>
                                    <p:panel styleClass="panelForm" header="Registration Form">
                                        <h:panelGrid columns="2" id="regGrid">
                                            <h:outputLabel for="firstName">First Name:</h:outputLabel>
                                            <p:inputText styleClass="inputTextStyle" id="firstName" value="#{registrationBean.user.firstName}" required="true" requiredMessage="First Name required.">
                                            </p:inputText>

                                            <h:outputLabel for="lastName">Last Name:</h:outputLabel>
                                            <p:inputText styleClass="inputTextStyle" id="lastName" value="#{registrationBean.user.lastName}" required="true" requiredMessage="Last name required.">
                                            </p:inputText>

                                            <h:outputLabel for="email">Email:</h:outputLabel>
                                            <p:inputText styleClass="inputTextStyle" id="email" value="#{registrationBean.user.email}" required="true" requiredMessage="E-mail required.">
                                            </p:inputText>

                                            <h:outputLabel for="password">Password:</h:outputLabel>
                                            <p:password styleClass="inputTextStyle" id="password" value="#{registrationBean.user.password}"
                                                        feedback="true" match="pwd2" validatorMessage="Password should match!" label="Password" required="true" requiredMessage="Password required."/>
                                            
                                            <h:outputLabel for="pwd2">Confirm Password:</h:outputLabel>
                                            <p:password styleClass="inputTextStyle" id="pwd2" label="Confirm Password"/>
                                        </h:panelGrid>
                                        <br/>
                                        <p:commandButton value="Register"
                                                         action="#{registrationBean.register()}" update="growl"/>
                                    </p:panel>
                                </h:form>
                            </f:view> 
                        </td>
                        <td width="25%">&nbsp;</td>
                    </tr>
                </table>

            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

